import random

lst = [random.randint(0, 22) for _ in range(20)]


def lst_sum(lst: list, sum: int) -> GeneratorExit:
    length = len(lst)
    for i in range(length - 1):
        for j in lst[i + 1:]:
            if lst[i] + j == sum:
                yield lst[i], j

x = lst_sum(lst, 22)

for i in x:
    print(i)

# 结果中没有进行数据去重